package com.bw.zg3_day05zy.news

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.bumptech.glide.Glide
import com.bw.base.mvvm.BaseActivity
import com.bw.zg3_day05zy.R
import com.bw.zg3_day05zy.databinding.ActivityNewsDetailBinding
import dagger.hilt.android.AndroidEntryPoint

@Route(path = "/app/NewsDetailActivity")
@AndroidEntryPoint
class NewsDetailActivity : BaseActivity<ActivityNewsDetailBinding, NewsViewModel>() {
    @Autowired
    @JvmField
    var newsId = 0
    override fun initView() {
        ARouter.getInstance().inject(this)
        viewModel.newsDetail(newsId)
    }

    override fun initData() {
        viewModel.detailData.observe(this){
            binding.detail = it
            Glide.with(this).load(it.images).into(binding.iv1)
//            Glide.with(this).load(it.images[1]).into(binding.iv2)
        }
    }

}